<?php
require_once('../../../config.php');
if (isset($_GET['id'])) {
	$stateid = $_GET['id'];
	
	$record = get_record("question_sourcecode_files", "id", $stateid);
	
	ob_clean();
	header('Content-type: ' . $record->mime);
	header('Content-Disposition: attachment; filename="' . $record->name);
	//echo $record->file;
	//echo file_get_contents($record->file);
	
	$result = mysql_query("SELECT * FROM mdl_question_sourcecode_files WHERE id = " . $stateid);
	
	echo mysql_result($result , 0 , "file");
}

?>
